using Engine;
using Game;
using GameEntitySystem;

namespace SCIENEW {
    public class BlastCastingBasinDevice : FourDirectionModelDevice, IEntityDevice<ComponentCastingBasin>, IFluidTransferrerDevice {
        public BlastCastingBasinDevice() : base("BlastCastingBasinDevice", "Models/CastingBasin", "CastingBasin", true, true) { }

        public override bool IsTransparent_(int value) => true;

        public override int GetFaceTextureSlot(int face, int value) => 70;

        public override int GetShadowStrength(int value) => 0;

        public override BoundingBox[] GetCustomCollisionBoxes(SubsystemTerrain terrain, int value) => [new BoundingBox(0, 0, 0, 1, 0.5f, 1)];

        public override string GetSoundMaterialName(SubsystemTerrain subsystemTerrain, int value) => "Stone";

        public string GetEntityName(int value) => "CastingBasin";

        public Widget GetWidget(IInventory inventory, ComponentCastingBasin component) => null;

        public override DeviceBehavior[] GetBehaviors(Project project) => [new BlastCastingBasinDeviceBehavior(project), new FluidTransferrerDeviceBehavior(project)];

        public FluidTransferrer? CreateFluidTransferrer(SubsystemFluidTransfer subsystemFluidTransfer, SubsystemTerrain subsystemTerrain, int value, Point3 point) => new CastingBasinTransferrer(point, subsystemTerrain);

        public FluidConnector? GetConnector(SubsystemTerrain terrain, int value, int face, int x, int y, int z) {
            if (face == CellFace.OppositeFace(GetDirection(value))) return new FluidConnector(new CellFace(x, y, z, face), FluidConnectorType.Input, 1);
            return null;
        }
    }
}